class DmsFile {
  String? id;
  String? name;
  String? documentno;
  String? content;
  String? directoryId;
  String? remark;
  String? createUid;
  String? createName;
  String? createDate;
  String? createStartDate;
  String? createEndDate;
  String? writeUid;
  String? writeDate;

  DmsFile({
    this.id,
    this.name,
    this.createUid,
    this.createName,
    this.createDate,
    this.createStartDate,
    this.createEndDate,
    this.writeUid,
    this.writeDate,
    this.directoryId,
    this.content,
    this.documentno,
    this.remark,
  });

  DmsFile copyWith({
    String? id,
    String? name,
    String? createUid,
    String? createDate,
    String? writeUid,
    String? writeDate,
    String? directoryId,
    String? content,
    String? documentno,
    String? documentTypeId,
    String? documentTypeName,
    String? directoryName,
    String? remark,
  }) {
    return new DmsFile(
      id: id ?? this.id,
      name: name ?? this.name,
      createUid: createUid ?? this.createUid,
      createDate: createDate ?? this.createDate,
      writeUid: writeUid ?? this.writeUid,
      writeDate: writeDate ?? this.writeDate,
      directoryId: directoryId ?? this.directoryId,
      content: content ?? this.content,
      documentno: documentno ?? this.documentno,
      remark: remark ?? this.remark,
    );
  }

  @override
  String toString() {
    return '''DmsFile{
      id: id,
      name: name,
      createUid: createUid,
      createDate: createDate,
      writeUid: writeUid,
      writeDate: writeDate,
      directoryId: directoryId,
      content: content,
      documentno: documentno,
      documentTypeId: documentTypeId,
      remark: remark,
    }''';
  }

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is DmsFile &&
          runtimeType == other.runtimeType &&
          id == other.id &&
          name == other.name &&
          createUid == other.createUid &&
          createDate == other.createDate &&
          writeUid == other.writeUid &&
          writeDate == other.writeDate &&
          directoryId == other.directoryId &&
          content == other.content &&
          documentno == other.documentno &&
          remark == other.remark);

  factory DmsFile.fromMap(Map<String, dynamic> map) {
    return new DmsFile(
      id: map['id'] != false ? map['id'].toString() as String? : "",
      name: map['name'] != false ? map['name'].toString() as String? : "",
      createUid: map['create_uid'] != false
          ? map['create_uid'][0].toString() as String?
          : "",
      createName: map['create_uid'] != false
          ? map['create_uid'][1].toString() as String?
          : "",
      createDate: map['create_date'] != false
          ? map['create_date'].toString() as String?
          : "",
      writeUid: map['write_uid'] != false
          ? map['write_uid'].toString() as String?
          : "",
      writeDate: map['write_date'] != false
          ? map['write_date'].toString() as String?
          : "",
      directoryId: map['directory_id'] != false
          ? map['directory_id'].toString() as String?
          : "",
      content:
          map['content'] != false ? map['content'].toString() as String? : "",
      documentno: map['documentno'] != false
          ? map['documentno'].toString() as String?
          : "",
      remark: map['remark'] != false ? map['remark'].toString() as String? : "",
    );
  }

  Map<String, dynamic> toMap() {
    // ignore: unnecessary_cast
    return {
      'id': this.id,
      'name': this.name,
      'createUid': this.createUid,
      'createDate': this.createDate,
      'writeUid': this.writeUid,
      'writeDate': this.writeDate,
      'directoryId': this.directoryId,
      'content': this.content,
      'documentno': this.documentno,
      'remark': this.remark,
    } as Map<String, dynamic>;
  }

  List toDomainList() {
    List list = [
      if (this.documentno != null && this.documentno != '')
        ['documentno', '=', this.documentno],
    ] as List;
    if (list.length == 0) {
      list.add(['id', '!=', null]);
    }
    // ignore: unnecessary_cast
    return list;
  }

  Map<String, dynamic> toOdooMap() {
    // ignore: unnecessary_cast
    return {
      'name': this.name,
      'directory_id': int.parse(this.directoryId!),
      'content': this.content,
      'documentno': this.documentno,
      'remark': this.remark,
    } as Map<String, dynamic>;
  }

//</editor-fold>

}
